Skip to content

refactor: [M3-9647] - Reduce api requests made for every keystroke in Volume attach drawer #12052

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

harsh-akamai
Copy link
Contributor

@harsh-akamai harsh-akamai commented Apr 17, 2025

Description πŸ“

CM fires an API request for every keystroke in Volume attach drawer.

Changes πŸ”„

  • Refactored the query to only run in the initial render

Target release date πŸ—“οΈ

N/A

Preview πŸ“·

Before After
Screen.Recording.2025-04-17.at.5.02.43.PM.mov
Screen.Recording.2025-04-17.at.5.07.32.PM.mov

How to test πŸ§ͺ

Reproduction steps

  • Navigate to "Add Volume" drawer under Linode Storage
  • Switch to "Attach" mode
  • Type anything on the Volume Select and see a /volumes request fired on each key store

Verification steps

  • Check that the /volumes request is only fired on the initial render of the drawer
Author Checklists

As an Author, to speed up the review process, I considered πŸ€”

πŸ‘€ Doing a self review
❔ Our contribution guidelines
🀏 Splitting feature into small PRs
βž• Adding a changeset
πŸ§ͺ Providing/improving test coverage
πŸ” Removing all sensitive information from the code and PR description
🚩 Using a feature flag to protect the release
πŸ‘£ Providing comprehensive reproduction steps
πŸ“‘ Providing or updating our documentation
πŸ•› Scheduling a pair reviewing session
πŸ“± Providing mobile support
β™Ώ Providing accessibility support


  • I have read and considered all applicable items listed above.

As an Author, before moving this PR from Draft to Open, I confirmed βœ…

  • All unit tests are passing
  • TypeScript compilation succeeded without errors
  • Code passes all linting rules

const { data: volume } = useVolumeQuery(
values.volume_id,
values.volume_id !== -1
);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enabled the useVolumeQuery only when Volume_id is set and not -1(default value)

@harsh-akamai harsh-akamai marked this pull request as ready for review April 17, 2025 12:55
@harsh-akamai harsh-akamai requested a review from a team as a code owner April 17, 2025 12:55
@harsh-akamai harsh-akamai requested review from dwiley-akamai and hasyed-akamai and removed request for a team April 17, 2025 12:55
@github-project-automation github-project-automation bot moved this from Review to Changes Requested in Cloud Manager Apr 17, 2025
@bnussman-akamai
Copy link
Member

PR looks good now! Do we still need to add debouncing?

@harsh-akamai
Copy link
Contributor Author

Added debouncing! cc: @bnussman-akamai

@linode-gh-bot
Copy link
Collaborator

Cloud Manager UI test results

πŸ”Ί 3 failing tests on test run #8 β†—οΈŽ

❌ Failingβœ… Passingβ†ͺ️ SkippedπŸ• Duration
3 Failing590 Passing4 Skipped136m 54s

Details

Failing Tests
SpecTest
❌placement-groups-linode-assignment.spec.tsCloud Manager Cypress Testsβ†’Placement Groups Linode assignment Β» Placement Groups Linode assignment
❌smoke-community-stackscripts.spec.tsCloud Manager Cypress Testsβ†’Community Stackscripts integration tests Β» Community Stackscripts integration tests
❌bucket-create-multicluster.spec.tsCloud Manager Cypress Testsβ†’Object Storage Multicluster Bucket create Β» Object Storage Multicluster Bucket create

Troubleshooting

Use this command to re-run the failing tests:

pnpm cy:run -s "cypress/e2e/core/placementGroups/placement-groups-linode-assignment.spec.ts,cypress/e2e/core/stackscripts/smoke-community-stackscripts.spec.ts,cypress/e2e/core/objectStorageMulticluster/bucket-create-multicluster.spec.ts"

Copy link
Contributor

@hasyed-akamai hasyed-akamai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, e2e failures are unrelated

@github-project-automation github-project-automation bot moved this from Changes Requested to Approved in Cloud Manager May 19, 2025
@hasyed-akamai hasyed-akamai added Approved Multiple approvals and ready to merge! Bug Fixes for regressions or bugs labels May 19, 2025
@harsh-akamai harsh-akamai merged commit 5dc85c0 into linode:develop May 21, 2025
34 of 35 checks passed
@github-project-automation github-project-automation bot moved this from Approved to Merged in Cloud Manager May 21, 2025
@harsh-akamai harsh-akamai deleted the M3-9647-reduce-api-calls-for-linode-volume branch May 21, 2025 11:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Approved Multiple approvals and ready to merge! Bug Fixes for regressions or bugs
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants